package com.yuqian.JavaSe.rpc.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

public class RPCProxyHandle implements InvocationHandler{
	
	private Object proxyEd;
	
	RPCProxyHandle(Object proxyEd){
		this.proxyEd = proxyEd;
	}
	
	public static Object getHandle(Class proxyEd) {
		return Proxy.newProxyInstance(proxyEd.getClassLoader(), new Class[] {proxyEd}, new RPCProxyHandle( proxyEd));
	}

	@SuppressWarnings("rawtypes")
	public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
		// TODO Auto-generated method stub
		//Class proxyEdClass = proxyEd.getClass();
		String name =((Class)proxyEd).getName();
		System.out.println(name);
		return null;
	}

}
